package com.alander.nexusgo.user.service;

import com.alander.nexusgo.common.model.dto.RegisterDTO;
import com.alander.nexusgo.common.model.dto.UserListDTO;
import com.alander.nexusgo.common.model.vo.UserInfoVO;
import com.alander.nexusgo.user.model.entity.User;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.web.multipart.MultipartFile;

import java.time.LocalDate;
import java.util.List;
import java.util.Map;

/**
 * @author alander
 * @createDate 2025-10-07 17:08:55
 */
public interface UserService extends IService<User> {

    String login(String username, String password, String clientIp);

    /**
     * 获取第三方登录重定向URL
     */
    String getOAuth2RedirectUrl(String provider);

    /**
     * 处理第三方登录回调
     */
    Map<String, Object> handleOAuth2Callback(String provider, String code, String state, String clientIp) throws Exception;

    /**
     * 绑定第三方账号
     */
    boolean bindSocialAccount(Long userId, String provider, String openId, String unionId,
                              String accessToken, String refreshToken, LocalDate expireTime,
                              Map<String, Object> userInfo);

    /**
     * 解绑第三方账号
     */
    boolean unbindSocialAccount(Long userId, String provider);


    UserInfoVO getUserInfo(String loginId);

    UserInfoVO getUserInfoByName(String username);

    boolean register(RegisterDTO registerDTO);

    boolean hasName(String userName);

    Boolean updateUserInfo(UserInfoVO userInfoVO);

    boolean logout();

    String refreshToken();

    List<UserInfoVO> listUserInfo(UserListDTO userListDTO);

    Boolean updatePassword(String oldPassword, String newPassword);

    Boolean save(UserInfoVO userInfoVO);

    Boolean deleteById(Long userId);

    Boolean updateStatus(Long userId, Integer status);

    String updateAvatar(MultipartFile avatar);
}